package controllers

import (
	"encoding/json"
	// "farmyard/models"

	"io/ioutil"
)

// Operations about Users
type IndexController struct {
	BaseController
}

type IndexResult struct {
	Promotions []interface{} `json:"promotions"`
	Weather    interface{}   `json:"weather"`
	ResShops   []interface{} `json:"res_shops"`
	LocalShops []interface{} `json:"local_shops"`
	Products   []interface{} `json:"products"`
}

// @Title Get
// @Description get user by uid
// @Param   uid	 	query   string 	true "微信的openid"
// @Success 200 {object} models.User
// @Failure 403 openid is empty
// @router /entrance [get]
func (c *IndexController) Get() {

	json_str, err := ioutil.ReadFile("interface/index.json")
	c.ErrStop(err)
	indexResult := IndexResult{}
	err = json.Unmarshal(json_str, &indexResult)
	c.ErrStop(err)

	c.Success(indexResult)
}
